What is the meaning of this pData[1+2*i]<<8|pData[2+2*i] C++ syntax?

Posted by user543265 on Stack Overflow See other posts from Stack Overflow or by user543265
Published on 2011-01-11T09:55:27Z Indexed on 2011/01/11 12:53 UTC
Read the original article Hit count: 110

Filed under:
|
|

what is the meqaning of pData[1+2*i]<<8|pData[2+2*i] where pData[ ] is the array containing BYTE data? I have the following function in the main function

{
..........
....
BYTE Receivebuff[2048];
..
ReceiveWavePacket(&Receivebuff[i], nNextStep);
....
...
..
}

Where Receivebuff is the array of type BYTE.

ReceiveWavePacket(BYTE * pData, UINT nSize)
{
 CString strTest;
 for(int i = 0 ; i < 60 ; i++)
 {
  strTest.Format("%d\n",(USHORT)(pData[1+2*i]<<8|pData[2+2*i]));
  m_edStatData.SetWindowTextA(strTest);
          }
}

I want to know the meaning of ",(USHORT)(pData[1+2*i]<<8|pData[2+2*i]).

Can any body please help me?

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-c++